<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <title>Status-app</title>
    <link rel="stylesheet" href="./css/style.css" media="screen">


</head>
<?php

$format = 'Y-m-j G:i:s'; 
$curdate = date($format); 
$date = date ( strtotime ("-1 hour -6 minutes" . $curdate ) ); 

$con = mysql_connect("localhost","root","hoop");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("home", $con);
?>
<table border="1" cellspacing="2" cellpadding="2">
<?php
$result = mysql_query("SELECT * FROM status"); 


$num=mysql_numrows($result);
$i=0;
while ($i < $num) {

$f1=mysql_result($result,$i,"name");
$time = mysql_result($result,$i,"date");
$f2 = date ( strtotime ($time ) );
if (mysql_result($result,$i,"status")=="0") 
		$f3 = "is out";
	elseif (mysql_result($result,$i,"status")=="1" && $f2 <= $date)
		$f3 = "is out";
	else
		$f3 = "is in";

?>
<tr>
<td><?php echo $f1 . " " . $f3; ?></td>

</tr>
  <?php
$i++;
}
?>
</table>
<?

mysql_close($con);
?>
</html>